package com.example.dllo.exe.main;


import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

import com.example.dllo.exe.me.MeFragment;
import com.example.dllo.exe.R;
import com.example.dllo.exe.fenlei.FenLeiFragment;
import com.example.dllo.exe.giftspeak.GiftSpeakFragment;
import com.example.dllo.exe.remen.ReMenFragment;

public class MainAty extends BaseAty implements OnCheckedChangeListener {


    private RadioGroup radioGroup;

    @Override
    protected int setLayout() {
//        return R.layout.welcomeactivitylayout;
        return R.layout.activity_main;
    }

    @Override
    protected void initView() {
        radioGroup = (RadioGroup) findViewById(R.id.Radio_Group);



    }

    @Override
    protected void initData() {
        radioGroup.setOnCheckedChangeListener(this);
        radioGroup.check(R.id.giftspeak_radioButton);
        // 初始化BmobSDK


    }

    @Override
    public void onCheckedChanged(RadioGroup radioGroup, int i) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

        switch (i) {
            case R.id.giftspeak_radioButton:
                fragmentTransaction.replace(R.id.Fragment_Layout, new GiftSpeakFragment()) ;


                break;
            case R.id.remen_radioButton:
                fragmentTransaction.replace(R.id.Fragment_Layout, new ReMenFragment());

                break;
            case R.id.feilei_radioButton:
                fragmentTransaction.replace(R.id.Fragment_Layout, new FenLeiFragment());

                break;
            case R.id.me_redioButton:
                fragmentTransaction.replace(R.id.Fragment_Layout, new MeFragment());

                break;
        }
        fragmentTransaction.commit();


    }
}
